package com.todo1.unit_testing.services.customer;



public class CustomerServicesImpl implements CustomerServices {
	
	public static final int SIMULATED_AVAILABLE_CREDIT = 30000;

	public boolean creditAvailable(String customerId, double amount) {
		System.out.println("Consultando en DB cr�dito para el cliente: " + customerId);
		System.out.println();
		
		boolean creditAvailable = simulatedCreditAvailable(customerId, amount);
		
		if (creditAvailable) {
			System.out.println("El cliente con id " + customerId + " tiene cr�dito" +
					"suficiente para $" + amount);
			System.out.println();
		}
		return creditAvailable;
	}
	
	
	private boolean simulatedCreditAvailable(String customerId, double amount) {
		if(amount < SIMULATED_AVAILABLE_CREDIT) {
			return true;
		}
		return false;
	}
}
